// ! flags
export const NoFlags = /*                      */ 0b00000000000000000000;

export const Placement = /*                    */ 0b0000000000000000000010; // 2
export const Update = /*                       */ 0b0000000000000000000100; // 4
export const Deletion = /*                     */ 0b0000000000000000001000; // 8

export function isFn(fn: any) {
  return typeof fn === "function";
}
export function isStr(s: any) {
  return typeof s === "string";
}
export function isArray(arr: any) {
  return Array.isArray(arr);
}
export function isStringOrNumber(s: any) {
  return typeof s === "string" || typeof s === "number";
}

export function updateNode(node: any, nextVal: any) {
    Object.keys(nextVal).forEach(k => {
        if(k === 'children') {
            if(isStringOrNumber(nextVal[k])) {
                node.textContent = nextVal[k]
            }
        } else {
            node[k] = nextVal[k]
        }
    })
}
